const
waitTime = 3;
var wait = waitTime;
/*$(function() {
	var $fullText = $('.admin-fullText');
	$('#admin-fullscreen').on('click', function() {
		$.AMUI.fullscreen.toggle();
	});

	$(document).on(
			$.AMUI.fullscreen.raw.fullscreenchange,
			function() {
				$.AMUI.fullscreen.isFullscreen ? $fullText.text('关闭全屏')
						: $fullText.text('开启全屏');
			});

	$('#window-back').click(function() {
		window.history.back();
	});
});*/

function slideLeft(o, animationClass) {
	if ($.AMUI.support.animation) {
		o.addClass('am-animation-slide-left').one($.AMUI.support.animation.end,
				function() {
					o.removeClass('am-animation-slide-left');
				});
	}
}

function animation(o, animationClassArr) {
	if ($.AMUI.support.animation) {
		for (i = 0; i < animationClassArr.length; i++) {
			o.addClass(animationClassArr[i]);
		}
		o.one($.AMUI.support.animation.end, function() {
			for (i = 0; i < animationClassArr.length; i++) {
				o.removeClass(animationClassArr[i]);
			}
		});
	}
}

function execTime(btn) {
	wait = waitTime;
	btn.attr("disabled", "true");
	time(btn);
}

function time(btn) {
	if (wait == 0) {
		btn.removeAttr('disabled');
		btn.text("重新获取验证码");
		wait = 60;
	} else {
		btn.attr("disabled", "true");
		btn.text(wait + "秒");
		wait--;
		setTimeout(function() {
			time(btn)
		}, 1000)
	}
}

function phoneValidate(mobile) {
	if (mobile == null)
		return false;
	var reg = /^1((3|5|8){1}\d{1}|70)\d{8}$/;
	var r = mobile.match(reg);
	if (r == null) {
		return false;
	}
	return true;

}

function isEmpty(str) {
	if (str == null || str == "") {
		return true;
	}
	return false;
}

function isNotEmpty(str) {
	return !isEmpty(str);
}

function showAlert(msg) {
	if (isNotEmpty(msg)) {
		$('#alertMsg').text(msg);
		$('#alertMsg').removeClass('am-hide');
		setTimeout(function() {
			$('#alertMsg').addClass('am-hide');
		}, 4000);
	}
}

function showSuccessMsg(msg, url) {
	if (isNotEmpty(msg)) {
		$('#alertMsg').text(msg);
		$('#alertMsg').removeClass('am-hide');
		setTimeout(function() {
			$('#alertMsg').addClass('am-hide');
			location.href = url;
		}, 1000);
	}
}


